home *** CD-ROM | disk | FTP | other *** search
- // Scene File: CUBIC.PI
- // Author: Rob McGregor
-
- /*************************************************
- Three spheres follow different cubic paths,
- starting and ending at the same points
- **************************************************/
-
- include "..\..\..\colors.inc"
- include "..\..\..\texture.inc"
-
- // SET UP THE CAMERA
- viewpoint {
- from <4.5, 0, -12>
- at <4.5, 1, 0>
- up <0, 1, 0>
- angle 45
- resolution 320, 200
- aspect 1.6
- }
-
- // Set the sky color and add a little haze
- background Grey
- haze 0.98, 25, Grey
-
- // Lights
- light <-5, 5, -20>
- light <5, 5, -20>
-
- // Define the range of the animation
- start_frame 0
- end_frame 49
- outfile "cubic"
-
- define s1_Nc 10.0 // Nc for sphere1 (red)
- define s2_Nc 2.5 // Nc for sphere2 (yellow)
- define s3_Nc -5.0 // Nc for sphere3 (blue)
-
- define s1_Nd -2 // Nd for sphere1 (red)
- define s2_Nd 5 // Nd for sphere2 (yellow)
- define s3_Nd 3 // Nd for sphere3 (blue)
-
- // Sphere1
- define s1N1x 0 // x-axis starting point
- define s1N1y -1 // y-axis starting point
- define s1N2x 9 // x-axis ending point
- define s1N2y -1 // y-axis ending point
-
- // Sphere2
- define s2N1x 0 // x-axis starting point
- define s2N1y 0 // y-axis starting point
- define s2N2x 9 // x-axis ending point
- define s2N2y 0 // y-axis ending point
-
- // Sphere3
- define s3N1x 0 // x-axis starting point
- define s3N1y 1 // y-axis starting point
- define s3N2x 9 // x-axis ending point
- define s3N2y 1 // y-axis ending point
-
- // Calculate the value of t as:
- // t = (F - F1) / (F2 - F1)
- define t (frame - start_frame) / (end_frame - start_frame)
-
- // Now calculate the locations of the spheres using:
- // N = (1 - t)^3 * N1 + (t^3) * N2 + 3 * t *
- // ((1 - t)^2) * Nc + 3 * (t^2) * (1 - t) * Nd
-
- define s1_x (1 - t)^3 * s1N1x + (t^3) * s1N2x + 3 * t *
- ((1 - t)^2) * s1_Nc + 3 * (t^2) * (1 - t) * s1_Nd
- define s1_y (1 - t)^3 * s1N1y + (t^3) * s1N2y + 3 * t *
- ((1 - t)^2) * s1_Nc + 3 * (t^2) * (1 - t) * s1_Nd
-
- define s2_x (1 - t)^3 * s2N1x + (t^3) * s2N2x + 3 * t *
- ((1 - t)^2) * s2_Nc + 3 * (t^2) * (1 - t) * s2_Nd
- define s2_y (1 - t)^3 * s2N1y + (t^3) * s2N2y + 3 * t *
- ((1 - t)^2) * s2_Nc + 3 * (t^2) * (1 - t) * s2_Nd
-
- define s3_x (1 - t)^3 * s3N1x + (t^3) * s3N2x + 3 * t *
- ((1 - t)^2) * s3_Nc + 3 * (t^2) * (1 - t) * s3_Nd
- define s3_y (1 - t)^3 * s3N1y + (t^3) * s3N2y + 3 * t *
- ((1 - t)^2) * s3_Nc + 3 * (t^2) * (1 - t) * s3_Nd
-
-
- // Set the positions of the spheres
- define s1_loc <s1_x, s1_y, 0>
- define s2_loc <s2_x, s2_y, 0>
- define s3_loc <s3_x, s3_y, 0>
-
- // Create 3 spheres
- object { sphere s1_loc, 0.5 reflective_red }
- object { sphere s2_loc, 0.5 reflective_yellow }
- object { sphere s3_loc, 0.5 reflective_blue }
-
- // The floor...
- object {
- disc <0, 0, 0>, <0, 1, 0>, 10000
- texture {
- checker steely_blue,
- texture { shiny { color white }}
- }
- rotate <0, 25, 0>
- translate <0, -3.5, 0>
- }
-